package com.app.util.common;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonBackReference;

@JSONType(ignores="strUserId")
public class HandlerResultMobile {

	private String strSid;
	
	private boolean success;
	
	private String strRlt;
	
	private String strError = "";
	
	private Integer intCurPage = 1;	
	
	private Integer intPageSize = 10;
	
	private Integer intAllCount = 0;
	
	private String strUserId;		//当前登录人的id
	
	private String strUserName;		//当前登录人的名字
	
	private String strLoginedUnitName;	//登录人所在部门
	
	
	private String strLoginedUnitId;
	
	private String strLoginedSchoolId;
	
	private String strUnitIds;			//用户所有的
	
	
	 
	
	private Map<String,Object> tempMap = new HashMap<String,Object>();
	
	
	@JsonBackReference
	public void put(String key ,Object obj){
		tempMap.put(key, obj);
	}
	
	public Object get(String key){
		return tempMap.get(key);
	}

	public String getStrSid() {
		return strSid;
	}

	@JsonBackReference
	public void setStrSid(String strSid) {
		this.strSid = strSid;
	}


	public boolean isSuccess() {
		return success;
	}

	@JsonBackReference
	public void setSuccess(boolean success) {
		this.success = success;
	}

	

	public String getStrError() {
		return strError;
	}

	@JsonBackReference
	public void setStrError(String strError) {
		this.strError = strError;
	}
	
	

	public Map<String, Object> getTempMap() {
		return tempMap;
	}

	@JsonBackReference
	public void setTempMap(Map<String, Object> tempMap) {
		this.tempMap = tempMap;
	}
	
	
	
	public Integer getIntCurPage() {
		return intCurPage;
	}

	@JsonBackReference
	public void setIntCurPage(Integer intCurPage) {
		this.intCurPage = intCurPage;
	}

	public Integer getIntPageSize() {
		return intPageSize;
	}

	@JsonBackReference
	public void setIntPageSize(Integer intPageSize) {
		this.intPageSize = intPageSize;
	}

	public Integer getIntAllCount() {
		return intAllCount;
	}

	@JsonBackReference
	public void setIntAllCount(Integer intAllCount) {
		this.intAllCount = intAllCount;
	}
	
	public String getStrUserId() {
		return strUserId;
	}

	@JsonBackReference
	public void setStrUserId(String strUserId) {
		this.strUserId = strUserId;
	}

	

	public String getStrLoginedUnitId() {
		return strLoginedUnitId;
	}

	@JsonBackReference
	public void setStrLoginedUnitId(String strLoginedUnitId) {
		this.strLoginedUnitId = strLoginedUnitId;
	}

	public String getStrLoginedSchoolId() {
		return strLoginedSchoolId;
	}

	@JsonBackReference
	public void setStrLoginedSchoolId(String strLoginedSchoolId) {
		this.strLoginedSchoolId = strLoginedSchoolId;
	}

	public String getStrUnitIds() {
		return strUnitIds;
	}

	@JsonBackReference
	public void setStrUnitIds(String strUnitIds) {
		this.strUnitIds = strUnitIds;
	}
	
	

	public String getStrRlt() {
		return strRlt;
	}

	@JsonBackReference
	public void setStrRlt(String strRlt) {
		this.strRlt = strRlt;
	}
	
	
	

	public String getStrUserName() {
		return strUserName;
	}

	@JsonBackReference
	public void setStrUserName(String strUserName) {
		this.strUserName = strUserName;
	}

	public String getStrLoginedUnitName() {
		return strLoginedUnitName;
	}

	@JsonBackReference
	public void setStrLoginedUnitName(String strLoginedUnitName) {
		this.strLoginedUnitName = strLoginedUnitName;
	}

	public String toMobileJson(boolean showPageInfo){
		Map<String,Object> resultMap = new HashMap<String,Object>();
		
		try{
		Map<String,Object> tempMap = new HashMap<String,Object>();
		tempMap.put("strSid", this.getStrSid());
		tempMap.put("strError", this.getStrError());
		if(this.getStrRlt() != null && !this.getStrRlt().equals("")) {
			tempMap.put("strRlt", this.getStrRlt());
		}else {
			tempMap.put("strRlt", String.valueOf(this.isSuccess()));
		}
		if(showPageInfo){
			tempMap.put("intCurPage", intCurPage);
			tempMap.put("intPageSize", intPageSize);
			tempMap.put("intAllCount", intAllCount);
		}
		tempMap.putAll(this.getTempMap());
		
		resultMap.put("result", tempMap);
		}catch(Exception e){
			e.printStackTrace();
		}
		return JsonUtil.toJsonString(resultMap);
	}
	
	
	public String toMobileJson(Boolean showPageInfo,String dateType){
		Map<String,Object> resultMap = new HashMap<String,Object>();
		
		Map<String,Object> tempMap = new HashMap<String,Object>();
		tempMap.put("strSid", this.getStrSid());
		tempMap.put("strError", this.getStrError());
		if(this.getStrRlt() != null && !this.getStrRlt().equals("")) {
			tempMap.put("strRlt", this.getStrRlt());
		}else {
			tempMap.put("strRlt", String.valueOf(this.isSuccess()));
		}
		tempMap.put("strRlt", String.valueOf(this.isSuccess()));
		if(showPageInfo){
			tempMap.put("intCurPage", intCurPage);
			tempMap.put("intPageSize", intPageSize);
			tempMap.put("intAllCount", intAllCount);
		}
		tempMap.putAll(this.getTempMap());
		
		resultMap.put("result", tempMap);
		
		return JsonUtil.toJsonString(resultMap, dateType);
	}
	
	
	
}
